import { ResPage, ReqPage } from '@/api/interface'
import { TBY } from '@/api/config/servicePort'
import http from '@/api'

/**宣教馆 */
export namespace EducationRoad {
  export interface Query extends ReqPage {
    name?: string
  }

  export interface Record {
    /**主键id */
    id: number
    /**名称*/
    name: string
    /**长度 */
    length: number
  }

  export interface Form {
    /**主键id */
    id: number
    /**名称*/
    name: string
    /**长度 */
    length: number
  }
}

export const pageEducationRoad = (params: EducationRoad.Query) => {
  return http.get<ResPage<EducationRoad.Record>>(TBY + `/education_road/page`, params)
}

// 详情
export const getEducationRoadDetail = (id: number) => {
  return http.get<Partial<EducationRoad.Form>>(TBY + `/education_road/get`, { id }, { loading: false })
}

// 新增或修改
export const saveOrUpdateEducationRoad = (params: Partial<EducationRoad.Form>) => {
  return http.post(TBY + `/education_road/save`, params)
}

// 删除
export const removeEducationRoad = (id: number) => {
  return http.delete(TBY + `/education_road/delete`, { id })
}

// 列表
export const listEducationRoad = (params: EducationRoad.Query) => {
  return http.get<EducationRoad.Record[]>(TBY + `/education_road/list`, params)
}
